import { storeToRefs } from "pinia";
import {postMenu} from "@/api/index";
import { useUserStore } from "@/stores/user";

function useHome() {
  const store = useUserStore();
  const { count } = storeToRefs(store);
  const { increment, reset } = store;

  function getData(stopPullDown) {
    postMenu("/home");
    stopPullDown && stopPullDown();
  }

  // 初始执行
  getData();

  return {
    count,
    increment,
    reset,
    getData,
  };
}

export default useHome;
